<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$basic=$this->plugin_setting('basic');
$return['hdps']=$basic['hdps'];
if($_RQ['op']=='main'){
	set_html('title','科室列表');
	exi($return);
}
if($_RQ['op']=='getlist'){
	$post=get_postdata();
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if(isset($_RQ['status']) && $_RQ['status'] !=10){
		$params['status']=intval($_RQ['status']);
		$return['status']=intval($_RQ['status']);
	}else{
		$return['status']=10;
	}
	//排序门店
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;	
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
		'fields'=>$fields,
		'orderby'=>$orderby,
	);
	$list=pdo_getslice('jy_zhongyi_lesson_log',$params,array($pindex,$psize),$total,$fields,'','id desc');
	$sum=0;
	if($list){
		$sum=count($list);
		$weekarray=array("日","一","二","三","四","五","六"); //先定义一个数组
		foreach($list as &$item){
			$item['lesson']=pdo_get('jy_zhongyi_lesson',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['lesson_id']));
			$item['lesson']['starttime']=date('Y-m-d',$item['lesson']['starttime']);
			$item['lesson']['endtime']=date('Y-m-d',$item['lesson']['endtime']);
			$item['store']=pdo_get('jy_zhongyi_store',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['storeid']));
			$item['lesson']['area_title']=pdo_getcolumn('jy_zhongyi_area',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['lesson']['area_id']),'title');
			$item['ontime']=date('Y-m-d H:i:s',$item['ontime']);
		}
	}
	$return['list']=$list;
	$return['sum']=$sum;
	set_html('title','预约列表');
	exi($return);
}
//订单详情
if($_RQ['op']=='detail'){
	$payid=intval($_RQ['payid']);
	$id=intval($_RQ['id']);
	if(!$id){
		exi('订单不存在，请重新选择'.$id,'error');
	}
	if($id){
		$order=$this->model('order')->get_lessonlog($id);
	}
	$return['member']=model('core/member')->detail($order['mid'],array('credit1','credit2','mobile','avatar','nickname'));
	$return['order']=$order;
	set_html('title','课时详情');
	exi($return);
}	
